package com.example.tests;

import org.testng.annotations.Test;

public class GroupTests extends BaseClass {

	@Test
	public void shouldCreateGroupWithAllFields() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getNavigationHelper().clickGroupsLink();
		GroupFields group = new GroupFields();
		String DEFAULT_GROUP_NAME = "New Group";
		String DEFAULT_GROUP_HEADER = "Default Header";
		String DEFAULT_GROUP_FOOTER = "Default Footer";
		group.setName(DEFAULT_GROUP_NAME);
		group.setHeader(DEFAULT_GROUP_HEADER);
		group.setFooter(DEFAULT_GROUP_FOOTER);
		app.getGroupHelper().createGroup(group);
		app.getGroupHelper().gotoGroupPage();
	}
	
	@Test
	public void shouldCreateGroupWithAllFieldsNotUnique() throws Exception {
		shouldCreateGroupWithAllFields();
	}
	
	@Test
	public void shouldCreateGroupWithNoFields() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getNavigationHelper().clickGroupsLink();
		app.getGroupHelper().createGroup(new GroupFields());
		app.getGroupHelper().gotoGroupPage();
	}
	
	@Test
	public void shouldEditFirstGroupInTheList() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getNavigationHelper().clickGroupsLink();
		GroupFields group = new GroupFields();
		group.setName("Edited group name");
		group.setHeader("Edited group header");
		group.setFooter("Edited group footer");
		app.getGroupHelper().editGroup(group);
		app.getGroupHelper().gotoGroupPage();
	}
	
	@Test
	public void shouldDeleteFirstGroupInTheList() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getNavigationHelper().clickGroupsLink();
		app.getGroupHelper().deleteGroup();
		app.getGroupHelper().gotoGroupPage();
	}
	
}